#include <iostream>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <cassert>
#define PipeName "./Named_pipe"

int main()
{
    int fd = open(PipeName, O_RDONLY);
    char buffer[1024];
    while (true)
    {
        int ret = read(fd, buffer, sizeof(buffer));
        if(ret == 0)
            break;
        buffer[ret] = 0;
        std::cout << "transmit-> "<< buffer << std::endl;
    }
    close(fd);
    unlink(PipeName);
    return 0;
}